package com.guigu.tms.base.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.guigu.tms.base.mapper.PdTruckDriverMapper;
import com.guigu.tms.base.service.IPdTruckDriverService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.guigu.tms.commons.entity.base.BaseTruckType;
import com.guigu.tms.commons.entity.base.PdTruckDriver;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 司机表 服务实现类
 * </p>
 *
 * @author wj
 * @since 2022-09-26
 */
@Service
public class PdTruckDriverServiceImpl extends ServiceImpl<PdTruckDriverMapper, PdTruckDriver> implements IPdTruckDriverService {

    @Autowired
    PdTruckDriverMapper pdTruckDriverMapper;

    @Override
    public PageInfo<PdTruckDriver> findTruckDriverList(Map<String, String> map) {
        String pageindex=map.get("pageindex");
        String pagenum=map.get("pagenum");
        int page=Integer.valueOf(pageindex)<=0?1:Integer.valueOf(pageindex);
        PageHelper.startPage(page,Integer.valueOf(pagenum));
        List<PdTruckDriver> pdTruckDrivers = pdTruckDriverMapper.findTruckDriverList(map);
        return new PageInfo<>(pdTruckDrivers);
    }

    @Override
    public int UpdateFleetByDriver(PdTruckDriver pdTruckDriver) {
        return pdTruckDriverMapper.updateById(pdTruckDriver);
    }

    @Override
    public PdTruckDriver ShowInformation(String UserId) {
        return pdTruckDriverMapper.ShowInformation(UserId);
    }
}
